<%--
  Created by IntelliJ IDEA.
  User: EDY
  Date: 2023-11-01
  Time: 8:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="../../js/jquery-3.3.1.js"></script>
    <script src="../../js/bootstrap-table.min.js"></script>
    <script src="../../js/bootstrap.bundle.min.js"></script>
    <script src="../../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../js/jquery.form.js"></script>
    <script src="../../js/jquery.validate.js"></script>
    <script src="../../js/messages_zh.js"></script>
    <link rel="stylesheet" href="../../css/bootstrap-table.min.css">
    <link rel="stylesheet" href="../../css/bootstrap.min.css">
</head>
<body>
    <table width="100%">
        <tbody>
        <tr height="20">
            <td>
                <span style="color: #0c84ff">您正在做的业务是：产品设计--产品物料组成设计--物料组成设计单审核</span>
            </td>
        </tr>
        <tr height="20">
            <td align="right">
                审核通过<input type="radio" name="checkTag" value="S001-1" checked="checked">
                审核不通过<input type="radio" name="checkTag" value="S001-2">
                <input type="button" onclick="checkOk()" value="确认">
                <input type="button" value="返回" onclick="history.back();">
            </td>
        </tr>
        </tbody>
    </table>
    <div>
        <table width="80%" align="center" border="0" bgcolor="#FFFFFF">
            <tbody>
            <tr>
                <td rowspan="2">
                    <table cellspacing="0" cellpadding="0" width="100%" style="border: #333333 1px solid;">
                        <tbody>
                        <tr>
                            <td colspan="4" height="10">
                                <table width="100%">
                                    <tbody>
                                    <tr>
                                        <td>
                                            <table align="center">
                                                <tbody>
                                                <tr height="20">
                                                    <td align="center" height="5"><font size="4"><b>物料组成设计单</b></font>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            <table align="center">
                                                <tbody>
                                                <tr height="20">
                                                    <td align="center" height="5">&nbsp;</td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            <table align="center" id="theObjTable">
                                                <tbody>
                                                <tr height="20px">
                                                    <td align="right" width="12%">
                                                        设计单编号：
                                                    </td>
                                                    <td>
                                                        <input type="text" readonly name="designId" style="outline: none;border: 0px">
                                                    </td>
                                                    <td>
                                                        设计人：
                                                    </td>
                                                    <td>
                                                        <input type="text" name="designer" style="outline: none;width: 100%;border:0px;border-bottom:1px solid;">
                                                    </td>
                                                </tr>
                                                <tr height="20px">
                                                    <td align="right">
                                                        产品名称：
                                                    </td>
                                                    <td>
                                                        <input type="text" readonly name="productName" style="outline: none;border: 0px">
                                                    </td>
                                                    <td align="left" >
                                                        产品编号：
                                                    </td>
                                                    <td>
                                                        <input type="text" readonly name="productId" style="outline: none;border: 0px">
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            <table align="center">
                                                <tbody>
                                                <tr height="20">
                                                    <td align="center" height="5">&nbsp;</td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            <table border="1" cellspacing="0" cellpadding="0"
                                                   align="center" id="tableOnlineEdit" style="text-align: center;">
                                                <thead>
                                                <tr height="20" bgcolor="#D2E9FF">
                                                    <td bordercolor="#DEDBD6" align="left" width="5%">
                                                        序号
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left"
                                                        width="13%">物料名称
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left"
                                                        width="11%">物料编号
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left"
                                                        width="13%">用途类型
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left" width="8%">
                                                        描述
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left" width="8%">
                                                        数量
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left" width="8%">
                                                        单位
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left"
                                                        width="11%">单价（元）
                                                    </td>
                                                    <td bordercolor="#DEDBD6" align="left"
                                                        width="13%">小计（元）
                                                    </td>
                                                </tr>
                                                </thead>
                                            </table>
                                            <table align="center">
                                                <tbody>
                                                <tr height="20">
                                                    <td align="center" height="5">&nbsp;</td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            <table align="center">
                                                <tbody>
                                                <tr height="20px">
                                                    <td align="right" width="10%">物料总成本：
                                                    </td>
                                                    <td width="30%">
                                                        <input name="costPriceSum" readonly style="border: 0px;outline: none">
                                                    </td>
                                                </tr>
                                                <tr height="20px">
                                                    <td align="right" width="10%">审核人：
                                                    </td>
                                                    <td width="30%">
                                                        <input type="text" name="checker" value="${sysUsers.loginId}" readonly style="outline: none;width: 100%;border:0px;border-bottom:1px solid;">
                                                    </td>
                                                    <td align="left" width="10%">审核时间：
                                                    </td>
                                                    <td align="left" width="30%">
                                                        <input name="checkTime" readonly style="border: 0px;outline: none">
                                                    </td>
                                                </tr>
                                                <tr height="20">
                                                    <td align="right" width="9%">设计要求：
                                                    </td>
                                                    <td align="left" colspan="3" width="89%">
                                                        <textarea rows="4" name="describe" style="width: 100%"></textarea>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" nowrap="" width="56">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" nowrap="" height="100"></td>
                            <td></td>
                        </tr>

                        <tr valign="bottom">
                            <td colspan="4" nowrap="" align="center"></td>
                        </tr>

                        <tr>
                            <td colspan="4" nowrap="" align="right"></td>
                        </tr>
                        </tbody>
                    </table>
                </td>
                <td width="1" bgcolor="#ffffff" height="2"></td>
                <td width="1" bgcolor="#ffffff" height="2"></td>
                <td width="1" bgcolor="#ffffff" height="2"></td>
            </tr>
            <tr>
                <td width="1" bgcolor="#333333" height="120"></td>
                <td width="1" bgcolor="#666666" height="120"></td>
                <td width="1" bgcolor="#999999" height="120"></td>
            </tr>
            <tr valign="top" align="right">
                <td colspan="4">
                    <table cellspacing="0" cellpadding="0" align="center" border="0">
                        <tbody>
                        <tr>
                            <td bgcolor="#333333" height="1"></td>
                        </tr>
                        <tr>
                            <td bgcolor="#666666" height="1"></td>
                        </tr>
                        <tr>
                            <td bgcolor="#999999" height="1"></td>
                        </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <script>
        $(":input[name='checkTime']").val(new Date().toLocaleString())
        $(function () {
            $.post("../../DesignModule/showDesignModuleById",{id:'${param.id}'},function (data) {
                $.each(data,function (key,value) {
                    if(key=="checker"){
                        return ;
                    }
                    if(key=="checkTime"){
                        return ;
                    }
                    if(key=="checkTag"){
                        return ;
                    }
                    $("input[name="+key+"]").val(value)
                })
            })
            var i=1;
            $.post("../../DesignModule/showDesignModuleDetailsByParentId",{id:'${param.id}'},function (data) {
                $.each(data,function (index,item) {
                    console.log(item)
                    var tr=$("<tr><td>"+i+"</td><td>"+item.productName+"</td><td>"+item.productId+"</td><td>"+(item.type=="Y001-1"?"商品":"物料")+"</td><td>"+item.productDescribe+"</td><td>"+item.amount+"</td><td>"+item.amountUnit+"</td><td>"+item.costPrice+"</td><td>"+item.subtotal+"</td></tr>")
                    i=i+1;
                    $("#tableOnlineEdit").append(tr);
                })
            })
        })
        function checkOk() {
            var checkTag=$(":input[name=checkTag]:checked").val();
            var id="${param.id}";
            var designId=$("#theObjTable :input[name='designId']").val()
            var designer=$("#theObjTable :input[name=designer]").val();
            var productName=$("#theObjTable :input[name=productName]").val();
            var productId=$("#theObjTable :input[name=productId]").val();
            var costPriceSum=$(":input[name='costPriceSum']").val()
            var checker=$(":input[name=checker]").val();
            var checkTime=$(":input[name=checkTime]").val();
            var describe=$(":input[name=describe]").val();
            var arr2={id:id,checkTag:checkTag,designId:designId,designer:designer,productName:productName,productId:productId,costPriceSum:costPriceSum,checker:checker,checkTime:checkTime,describe:describe}
            $.ajax({
                url:"/DesignModule/designDesignModuleVheckOk",
                type:"post",
                data:JSON.stringify(arr2),
                contentType:'application/json',
                dataType:"json",
                success:function (data) {
                    alert(data.msg)
                    if(data.code=='1'){
                        location.href="check_list.jsp";
                    }
                }
            })
        }
    </script>
</form>
</body>
</html>
